﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DotNet.Business;
using DotNet.Common;

public partial class caseList : System.Web.UI.Page
{
    #region 变量
    Tab_CaseBll tab_CaseBll = new Tab_CaseBll();
    Tab_CaseClassBll tab_CaseClassBll = new Tab_CaseClassBll();
    int _currentIndex=1;
    int _pageSize = 12;
    int _classID = 0;
    public string _className = "";
    #endregion

    #region 页面加载  
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["i"] != null)
            {
                this._currentIndex = Convert.ToInt32(Request.QueryString["i"]);
            }
            if (Request.QueryString["c"] != null)
            {
                this._classID = Convert.ToInt32(Request.QueryString["c"]);
            }
            //绑定方案类别
            bindCaseClass();
            //绑定方案
            this.bindCase();
        }      
    }
    #endregion

    #region 绑定方案类别
    /// <summary>
    /// 绑定类别
    /// </summary>
    private void bindCaseClass() 
    {
        Tab_CaseClass tab_CaseClass = tab_CaseClassBll.GetModel(this._classID);
        this._className =">"+tab_CaseClass.caseClassName;
    }
    #endregion


    #region 绑定方案
    /// <summary>
    /// 绑定方案
    /// </summary>
    private void bindCase()
    {
        this.Rep_Case.DataSource = this.tab_CaseBll.pageForCase(this._currentIndex, this._pageSize,this._classID);
        this.Rep_Case.DataBind();
    }
     #endregion
 
    #region 分页按钮
    /// <summary>
    /// 分页按钮
    /// </summary>
    public void htmlPaging()
    {
        string str = null;
        int count = 0;
        count = tab_CaseBll.getRecordCount(this._classID);
        int pcount = count % this._pageSize == 0 ? count / this._pageSize : count / this._pageSize + 1;
        str = "页次：" + this._currentIndex + "/" + pcount + "  每页" + this._pageSize + " 总收录数据" + count + "条";
        str += HtmlControls.pagIng(this._currentIndex, pcount, "caseList.aspx?i", "pageaa", "pagecurrent");
        Response.Write(str);
    }
    #endregion

}
